package com.sangmo.fts.common.authority.sql;


import com.sangmo.boot.framework.data.entity.Entity;

public class NativeSearchContext {
    private String alias;
    private Class<? extends Entity> root;
    private int aliasIndex;
    private int varIndex;

    public NativeSearchContext(String alias, Class<? extends Entity> root) {
        this.alias = alias;
        this.root = root;
    }

    public Class<? extends Entity> getRoot() {
        return root;
    }

    public void setRoot(Class<? extends Entity> root) {
        this.root = root;
    }

    public String getAlias() {
        return alias;
    }

    public void setAlias(String alias) {
        this.alias = alias;
    }

    public int getAliasIndex() {
        return aliasIndex;
    }

    public void setAliasIndex(int aliasIndex) {
        this.aliasIndex = aliasIndex;
    }

    public String createVar() {
        varIndex++;
        return alias + "_v" + varIndex;
    }

    public String createAlias() {
        aliasIndex++;
        return alias + "_" + aliasIndex;
    }
}
